<template>

  <div class="content">
    <!-- 我的 -->
    <div class="myorderform">
      <div class="myset">
        <img :alt="userInfo?userInfo.nickName:''" :src="myInfo.avatar" />
        <div v-if="myInfo">{{myInfo.nickName}}</div>
        <div v-else>请登录</div>
      </div>
      <div v-for="item,index in rightColumn" :key="index" @click="tabtop(index)" :class="current == index ? 'goodsbuy goodsbuyatv' : 'goodsbuy'">{{item }}</div>

    </div>
    <!-- 订单 -->

    <div class="orderform" v-if="myInfo">
      <mySurvey :myInfo="myInfo" @setIndex="setIndex" v-if="current == 0" />
      <!-- <rechargeMoney v-if="current == 1" /> -->
      <!--在线充值-->
      <GoodsOrde v-if="current == 1" />
      <GoodsCentre :myInfo="myInfo" @setIndex="setIndex" v-if="current == 2" />
      <!--商品订单-->
      <RechargeOrde v-if="current == 3" />
      <realName :myInfo="myInfo" v-if="current == 4" />

      <withdraw :myInfo="myInfo" @setIndex="setIndex" v-if="current == 5" />
      <billingDetails v-if="current == 6" />

    </div>
    <div class="orderform" v-else></div>

  </div>
</template>

<script>
import GoodsOrde from './myComponents/goodsOrde.vue' // 商品订单
import GoodsCentre from './myComponents/goodsCentre.vue' // 商品中心
import RechargeOrde from './myComponents/rechargeOrde.vue' // 充值订单
import rechargeMoney from './myComponents/rechargeMoney.vue' // 在线订单
import realName from './myComponents/realName.vue' // 实名认证
import mySurvey from './myComponents/mySurvey.vue' // 账号预览
import withdraw from './myComponents/withdraw.vue' // 账号预览
import billingDetails from './myComponents/billingDetails.vue' // 账单明细

export default {
  components: {
    GoodsOrde,
    RechargeOrde,
    rechargeMoney,
    realName,
    mySurvey,
    GoodsCentre,
    withdraw,
    billingDetails
  },
  data () {
    return {
      rightColumn: [
        '账户预览',
        // '在线充值',
        '商品订单',
        '商品中心',
        '充值订单',
        '实名认证',
        '提现管理',
        '账单明细'
      ],
      dialogTableVisible: false,
      myInfo: '',
      loading: false,
      disabled: false,
      tableData: [],
      searchinput: '',
      current: 0,
      indent: 1
    }
  },
  computed: {
    userInfo () {
      if (localStorage.getItem('token')) {
        this.getInfo()
      } else {
        this.myInfo = ''
        this.$router.replace('./')
      }
      return this.$store.state.userInfo
    }
  },

  mounted () {
    var e = this.$route.query
    if (e.id) {
      this.current = e.id
    }
  },
  methods: {
    getInfo () {
      this.$apis.getInfo().then(res => {
        this.myInfo = res.data.data
      })
    },
    setIndex (e) {
      this.current = e
    },
    tabtop (e) {
      if (e == 0) {
        this.getInfo()
      }
      this.current = e
    },
    orderform (e) {
      this.indent = e
    }
  }
}
</script>

<style lang="less" scoped>
.con-t-select {
  margin-top: 0px;
}
.content {
  display: flex;
  min-height: 100vh;
}
.myorderform {
  flex: 1;
  background-color: #fafafa;
}
.myset {
  text-align: center;
  padding: 70px 20px 50px;
  font-size: 16px;
  img {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    margin-bottom: 10px;
  }
  div {
    span {
      color: #d1483f;
    }
  }
}
.myorderform-title {
  font-size: 18px;
  margin-bottom: 30px;
  text-align: center;
}
.goodsbuy {
  padding: 15px 0px;
  color: #828282;
  font-size: 18px;
  cursor: pointer;
  text-align: center;
}
.goodsbuyatv {
  border-left: 4px solid #d82141;
  background-color: #fff;
}
.orderform {
  background-color: #fff;
  padding: 60px 40px;
  flex: 4;
  box-sizing: border-box;
}
.allorders {
  display: flex;
  margin-bottom: 20px;
}
.cancellation-order {
  border-right: 2px solid #ddd;
  padding: 0px 30px;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
}
.cancellation-active {
  color: #d82141;
}
.cancellation-order:last-child {
  border: none;
}
.cancellation-order:first-child {
  padding-left: 0;
}
.uni-input {
  border: 1px solid #e4e4e4;
  width: 30%;
  border-radius: 10px;
  padding: 10px 0;
  padding-left: 20px;
  margin-bottom: 40px;
}
.indent-select {
  display: flex;
  .uni-data-select {
    margin-right: 10px;
  }
  img {
    width: 80px;
    height: 60px;
  }
}
.uni-stat__select {
  margin-right: 40px;
  margin-bottom: 40px;
}
.seedetails {
  color: #fff;
  background: linear-gradient(#d82141, #f36638);
}

.search-programa {
  margin: 20px 0px;
  display: flex;
  align-items: center;
  .search-but {
    width: 40px;
    height: 28px;
    background: url("../../assets/static/select.png") no-repeat;
    background-size: contain;
    border: none;
    margin-left: 10px;
  }
  .search-input {
    width: 250px;
  }
}
.recharge-hd {
  border-left: 3px solid #d82141;
  padding: 2px 10px;
  margin-bottom: 30px;
}
.recharge-bd {
  width: 500px;
  margin-left: 150px;
}

.recharg-but {
  margin-left: 100px;
  margin-top: 20px;
}

.qrCodeUrl,
.out {
  width: 350px;
  height: 350px;
}

.out {
  background: url("../../assets/static/t-09.png") no-repeat center top 50px;
  background-size: 128px;
  text-align: center;
  line-height: 400px;
}

.particulars {
  margin: 30px 0px;
  padding: 15px;
  border-top: 1px solid #efefef;
  border-bottom: 1px solid #efefef;
}
.particulars-item {
  display: flex;
  line-height: 30px;
  b {
    color: #444444;
    font-size: 14px;
    flex: 1;
  }
  span {
    color: #888888;
    font-size: 16px;
    flex: 3;
  }
}
</style>